<div class="content-wrapper">

    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right">
            <a href="<?php echo $this->url('goods-category', ['action'=> 'add']);?>" class="btn btn-primary btn-sm"><i class="fa fa-plus"></i> <?php echo $this->translate('添加商品分类'); ?></a>
            <?php echo $this->HelpUrl('goodsCategoryList'); ?>
        </h1>

    </section>

    <section class="content">
        <?php echo $this->partial('layout/messages'); ?>

        <div class="row">
            <div class="col-xs-12">
                <div class="box erp-box">

                    <form method="post" action="<?php echo $this->url('goods-category', ['action' => 'updateAll']);?>" name="edit-all-form" id="edit-all-form">
                    <div class="box-body table-responsive no-padding">
                            <table class="table table-hover">
                                <thead>
                                <tr class="erp-bg-thead">
                                    <th width="2%"><input type="checkbox" class="minimal select-all-checkbox"></th>
                                    <th><?php echo $this->translate('分类名称(分类ID)'); ?></th>
                                    <th><?php echo $this->translate('分类编码'); ?></th>
                                    <th width="8%"><?php echo $this->translate('排序'); ?></th>
                                    <th width="18%"><?php echo $this->translate('操作'); ?></th>
                                </tr>
                                </thead>

                                <?php if($this->category) foreach ($this->category as $value) { ?>
                                    <tr>
                                        <td><input  name="select_id[]" value="<?php echo $value->getGoodsCategoryId(); ?>" type="checkbox" class="minimal"></td>
                                        <td>
                                            <?php if($value->getGoodsCategoryTopId() > 0) echo str_repeat('&nbsp;', substr_count($value->getGoodsCategoryPath(), ',') * 3); ?>|----
                                            <?php echo $this->escapeHtml($value->getGoodsCategoryName()).'(ID:'.$value->getGoodsCategoryId().')'?></td>
                                        <td><?php echo $this->escapeHtml($value->getGoodsCategoryCode()); ?></td>
                                        <td><input type="text" name="goods_category_sort[<?php echo $value->getGoodsCategoryId(); ?>]" value="<?php echo $value->getGoodsCategorySort(); ?>" class="form-control input-sm"></td>
                                        <td>
                                            <a href="<?php echo $this->url('goods-category',
                                                ['action'=>'edit', 'id'=>$value->getGoodsCategoryId()]); ?>"
                                               class="btn btn-xs btn-success"><i class="fa fa-pencil"></i> <?php echo $this->translate('编辑'); ?>
                                            </a>

                                            <a href="javascript:;" onclick="deleteConfirm('<?php echo $this->translate('您确实要删除该商品分类吗？'); ?>', '<?php echo $this->url('goods-category', ['action'=>'delete', 'id'=>$value->getGoodsCategoryId()], ['query' => ['qToken' => $this->common()->getCsrfValue()]]); ?>');" class="btn btn-xs btn-danger">
                                                <i class="fa fa-trash"></i> <?php echo $this->translate('删除'); ?>
                                            </a>

                                        </td>
                                    </tr>
                                <?php } ?>
                            </table>

                    </div>
                    <div class="box-footer clearfix">
                        <input type="checkbox" class="minimal select-all-checkbox"> <?php echo $this->translate('全选'); ?>
                        <select name="editAllState" class="form-control input-sm" style="width: 120px;display: inline;">
                            <option value=""><?php echo $this->translate('选择状态'); ?></option>
                            <option value="sort"><?php echo $this->translate('更新排序'); ?></option>
                        </select>
                        <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('更新'); ?></button>
                    </div>
                    </form>
                </div>

            </div>
        </div>

    </section>
</div>